themingengine: Don't draw background image if no area
authorBenjamin Otte <otte@redhat.com>
Wed, 11 Jan 2012 13:58:52 +0000 (14:58 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 11 Jan 2012 14:48:54 +0000 (15:48 +0100)
If the background positioning area is empty (width/height <=0), don't
attempt to draw the background image.

gtk/gtkthemingbackground.c

index a022c9d0ebd55f7294c0748e528143df93536056..2d5859f540b2f07ebc28296b556f7bddddd27772 100644 (file)
@@ -83,6 +83,8 @@ _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
     break;
   }
 
+  /* XXX: image_rect might have negative width/height here.
+   * Do we need to do something about it? */
   bg->image_rect = image_rect;
 }
 
@@ -123,7 +125,9 @@ _gtk_theming_background_paint (GtkThemingBackground *bg,
   gdk_cairo_set_source_rgba (cr, &bg->bg_color);
   cairo_paint (cr);
 
-  if (bg->image)
+  if (bg->image
+      && bg->image_rect.width > 0
+      && bg->image_rect.height > 0)
     {
       GtkCssBackgroundRepeat hrepeat, vrepeat;
       double image_width, image_height;